{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "<a href=\"https://colab.research.google.com/drive/15KslE_orxpqRTdKvSkJprJJVqUDDErOH?usp=sharing\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"></a>"
      ],
      "metadata": {
        "id": "TCdMZ_gQEmwC"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "### Orchestrator-Worker Pattern"
      ],
      "metadata": {
        "id": "tCVA_crandM0"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "id": "9KDvafvO3xX-"
      },
      "outputs": [],
      "source": [
        "!pip install -qU google-generativeai"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "import google.generativeai as genai\n",
        "import getpass\n",
        "from datetime import datetime"
      ],
      "metadata": {
        "id": "dKraTPaKniOe"
      },
      "execution_count": 2,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "Get free-tier Google's Gemini API Key here: https://aistudio.google.com/app/apikey"
      ],
      "metadata": {
        "id": "QCN3XdWQnkaA"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "API_KEY = getpass.getpass(\"Enter your Google API key: \")"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "N7ZgOdL0nn1j",
        "outputId": "bf9eaee7-f7fc-47f1-abcc-cb6c46dc6873"
      },
      "execution_count": 3,
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Enter your Google API key: ··········\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "genai.configure(api_key=API_KEY)"
      ],
      "metadata": {
        "id": "z2Jk6TVcnrNG"
      },
      "execution_count": 4,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "class Worker:\n",
        "    \"\"\"Specialized worker agent with specific tools\"\"\"\n",
        "    def __init__(self, name, role, tools):\n",
        "        self.name = name\n",
        "        self.role = role\n",
        "        self.tools = tools\n",
        "        self.model = genai.GenerativeModel(\"gemini-2.0-flash\")\n",
        "\n",
        "    def can_handle(self, task):\n",
        "        \"\"\"Check if worker can handle this task\"\"\"\n",
        "        task_lower = task.lower()\n",
        "        return any(tool in task_lower for tool in self.tools.keys())\n",
        "\n",
        "    def execute(self, task):\n",
        "        \"\"\"Execute task using available tools\"\"\"\n",
        "        print(f\"  👷 {self.name} working on: {task[:60]}...\")\n",
        "\n",
        "        # Find relevant tool\n",
        "        task_lower = task.lower()\n",
        "        tool_name = None\n",
        "        for tool in self.tools.keys():\n",
        "            if tool in task_lower:\n",
        "                tool_name = tool\n",
        "                break\n",
        "\n",
        "        if not tool_name:\n",
        "            return {\"error\": f\"{self.name} has no tool for this task\"}\n",
        "\n",
        "        # Execute tool\n",
        "        try:\n",
        "            result = self.tools[tool_name](task)\n",
        "            print(f\"     ✅ Completed with {tool_name}\\n\")\n",
        "            return {\n",
        "                \"worker\": self.name,\n",
        "                \"task\": task,\n",
        "                \"tool\": tool_name,\n",
        "                \"result\": result,\n",
        "                \"status\": \"success\"\n",
        "            }\n",
        "        except Exception as e:\n",
        "            print(f\"     ❌ Error: {e}\\n\")\n",
        "            return {\n",
        "                \"worker\": self.name,\n",
        "                \"task\": task,\n",
        "                \"error\": str(e),\n",
        "                \"status\": \"failed\"\n",
        "            }\n",
        "\n",
        "\n",
        "class Orchestrator:\n",
        "    \"\"\"Coordinates workers and synthesizes results\"\"\"\n",
        "    def __init__(self):\n",
        "        self.model = genai.GenerativeModel(\"gemini-2.0-flash-exp\")\n",
        "        self.workers = []\n",
        "\n",
        "    def add_worker(self, worker):\n",
        "        \"\"\"Register a worker\"\"\"\n",
        "        self.workers.append(worker)\n",
        "        print(f\"➕ Registered: {worker.name} ({worker.role})\")\n",
        "\n",
        "    def decompose_task(self, task):\n",
        "        \"\"\"Break down complex task into subtasks\"\"\"\n",
        "        workers_desc = \"\\n\".join([\n",
        "            f\"- {w.name}: {w.role} (tools: {', '.join(w.tools.keys())})\"\n",
        "            for w in self.workers\n",
        "        ])\n",
        "\n",
        "        prompt = f\"\"\"Break this task into subtasks for available workers.\n",
        "\n",
        "        Task: {task}\n",
        "\n",
        "        Available Workers:\n",
        "        {workers_desc}\n",
        "\n",
        "        Create 2-5 subtasks (one per line):\"\"\"\n",
        "\n",
        "        response = self.model.generate_content(prompt).text\n",
        "        subtasks = [line.strip() for line in response.split(\"\\n\") if line.strip()]\n",
        "        return subtasks[:5]\n",
        "\n",
        "    def assign_workers(self, subtasks):\n",
        "        \"\"\"Assign each subtask to appropriate worker\"\"\"\n",
        "        assignments = []\n",
        "\n",
        "        for subtask in subtasks:\n",
        "            # Find capable worker\n",
        "            worker = None\n",
        "            for w in self.workers:\n",
        "                if w.can_handle(subtask):\n",
        "                    worker = w\n",
        "                    break\n",
        "\n",
        "            if worker:\n",
        "                assignments.append({\n",
        "                    \"subtask\": subtask,\n",
        "                    \"worker\": worker\n",
        "                })\n",
        "            else:\n",
        "                print(f\"  ⚠️  No worker found for: {subtask}\")\n",
        "\n",
        "        return assignments\n",
        "\n",
        "    def execute_parallel(self, assignments):\n",
        "        \"\"\"Execute assignments (simulated parallel)\"\"\"\n",
        "        results = []\n",
        "\n",
        "        for assignment in assignments:\n",
        "            result = assignment[\"worker\"].execute(assignment[\"subtask\"])\n",
        "            results.append(result)\n",
        "\n",
        "        return results\n",
        "\n",
        "    def synthesize(self, task, results):\n",
        "        \"\"\"Combine worker results into final answer\"\"\"\n",
        "        successful_results = [r for r in results if r.get(\"status\") == \"success\"]\n",
        "\n",
        "        if not successful_results:\n",
        "            return \"No workers successfully completed their tasks.\"\n",
        "\n",
        "        results_summary = \"\\n\\n\".join([\n",
        "            f\"Worker: {r['worker']}\\nTask: {r['task']}\\nResult: {r['result']}\"\n",
        "            for r in successful_results\n",
        "        ])\n",
        "\n",
        "        prompt = f\"\"\"Synthesize these worker results into a comprehensive answer.\n",
        "\n",
        "        Original Task: {task}\n",
        "\n",
        "        Worker Results:\n",
        "        {results_summary}\n",
        "\n",
        "        Final Answer:\"\"\"\n",
        "\n",
        "        response = self.model.generate_content(prompt).text\n",
        "        return response.strip()\n",
        "\n",
        "    def execute(self, task):\n",
        "        \"\"\"Full orchestration pipeline\"\"\"\n",
        "        print(f\"\\n{'='*60}\")\n",
        "        print(f\"🎯 Task: {task}\")\n",
        "        print(f\"{'='*60}\\n\")\n",
        "\n",
        "        # Step 1: Decompose\n",
        "        print(\"📋 Step 1: Decomposing task...\")\n",
        "        subtasks = self.decompose_task(task)\n",
        "        print(f\"   Created {len(subtasks)} subtasks:\\n\")\n",
        "        for i, st in enumerate(subtasks, 1):\n",
        "            print(f\"   {i}. {st}\")\n",
        "        print()\n",
        "\n",
        "        # Step 2: Assign\n",
        "        print(\"👥 Step 2: Assigning workers...\")\n",
        "        assignments = self.assign_workers(subtasks)\n",
        "        print(f\"   Assigned {len(assignments)} tasks:\\n\")\n",
        "        for a in assignments:\n",
        "            print(f\"   - {a['worker'].name}: {a['subtask'][:50]}...\")\n",
        "        print()\n",
        "\n",
        "        # Step 3: Execute\n",
        "        print(\"⚡ Step 3: Executing in parallel...\\n\")\n",
        "        results = self.execute_parallel(assignments)\n",
        "\n",
        "        # Step 4: Synthesize\n",
        "        print(\"🔗 Step 4: Synthesizing results...\\n\")\n",
        "        final_answer = self.synthesize(task, results)\n",
        "\n",
        "        print(f\"{'='*60}\")\n",
        "        print(f\"📊 FINAL ANSWER\")\n",
        "        print(f\"{'='*60}\")\n",
        "        print(final_answer)\n",
        "        print()\n",
        "\n",
        "        return final_answer"
      ],
      "metadata": {
        "id": "_gJ8A59entEv"
      },
      "execution_count": 5,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "# Define worker tools\n",
        "def search_web(query):\n",
        "    \"\"\"Simulated web search\"\"\"\n",
        "    results = {\n",
        "        \"climate\": \"Climate change: Global temperatures rising 1.1°C since pre-industrial times.\",\n",
        "        \"ai\": \"AI developments: Large language models showing reasoning capabilities.\",\n",
        "        \"economy\": \"Economic outlook: Inflation stabilizing, GDP growth at 2.5%.\",\n",
        "        \"tech\": \"Tech trends: AI, quantum computing, and renewable energy leading innovation.\",\n",
        "    }\n",
        "    for key, val in results.items():\n",
        "        if key in query.lower():\n",
        "            return val\n",
        "    return f\"Search results for: {query}\"\n",
        "\n",
        "def analyze_data(task):\n",
        "    \"\"\"Simulated data analysis\"\"\"\n",
        "    return \"Analysis complete: Found 3 key trends, 85% confidence level, recommend action A.\"\n",
        "\n",
        "def fetch_database(task):\n",
        "    \"\"\"Simulated database query\"\"\"\n",
        "    return \"Database query returned 127 records. Top entry: ID=1001, Value=250, Status=Active.\"\n",
        "\n",
        "def api_call(task):\n",
        "    \"\"\"Simulated API request\"\"\"\n",
        "    return \"API Response: {status: 200, data: {users: 1500, active: 1200, growth: 15%}}\"\n",
        "\n",
        "def generate_report(task):\n",
        "    \"\"\"Simulated report generation\"\"\"\n",
        "    return \"Report generated: 5 pages, includes executive summary, 3 charts, recommendations.\"\n",
        "\n",
        "def send_notification(task):\n",
        "    \"\"\"Simulated notification\"\"\"\n",
        "    return \"Notification sent to 5 stakeholders via email and Slack.\"\n",
        "\n",
        "def calculate(task):\n",
        "    \"\"\"Simulated calculations\"\"\"\n",
        "    return \"Calculation: Total=1,250, Average=208.33, Growth Rate=12.5%\""
      ],
      "metadata": {
        "id": "xrIjatpHn16w"
      },
      "execution_count": 6,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "# Example 1: Research Task\n",
        "print(\"=\"*60)\n",
        "print(\"EXAMPLE 1: Multi-Domain Research\")\n",
        "print(\"=\"*60)\n",
        "\n",
        "orchestrator1 = Orchestrator()\n",
        "\n",
        "# Add specialized workers\n",
        "research_worker = Worker(\n",
        "    \"ResearchBot\",\n",
        "    \"Web research specialist\",\n",
        "    {\"search\": search_web}\n",
        ")\n",
        "\n",
        "data_worker = Worker(\n",
        "    \"DataAnalyst\",\n",
        "    \"Data analysis specialist\",\n",
        "    {\"analyze\": analyze_data, \"calculate\": calculate}\n",
        ")\n",
        "\n",
        "report_worker = Worker(\n",
        "    \"ReportWriter\",\n",
        "    \"Report generation specialist\",\n",
        "    {\"report\": generate_report}\n",
        ")\n",
        "\n",
        "orchestrator1.add_worker(research_worker)\n",
        "orchestrator1.add_worker(data_worker)\n",
        "orchestrator1.add_worker(report_worker)\n",
        "print()\n",
        "\n",
        "orchestrator1.execute(\n",
        "    \"Research climate change trends, analyze the data, and generate a report\"\n",
        ")\n",
        "\n",
        "\n",
        "# Example 2: Enterprise Workflow\n",
        "print(\"\\n\" + \"=\"*60)\n",
        "print(\"EXAMPLE 2: Enterprise Data Pipeline\")\n",
        "print(\"=\"*60)\n",
        "\n",
        "orchestrator2 = Orchestrator()\n",
        "\n",
        "db_worker = Worker(\n",
        "    \"DatabaseAgent\",\n",
        "    \"Database operations\",\n",
        "    {\"database\": fetch_database, \"fetch\": fetch_database}\n",
        ")\n",
        "\n",
        "api_worker = Worker(\n",
        "    \"APIAgent\",\n",
        "    \"External API integration\",\n",
        "    {\"api\": api_call, \"call\": api_call}\n",
        ")\n",
        "\n",
        "analytics_worker = Worker(\n",
        "    \"AnalyticsAgent\",\n",
        "    \"Data analytics\",\n",
        "    {\"analyze\": analyze_data, \"calculate\": calculate}\n",
        ")\n",
        "\n",
        "notification_worker = Worker(\n",
        "    \"NotificationAgent\",\n",
        "    \"Communication services\",\n",
        "    {\"notify\": send_notification, \"send\": send_notification}\n",
        ")\n",
        "\n",
        "orchestrator2.add_worker(db_worker)\n",
        "orchestrator2.add_worker(api_worker)\n",
        "orchestrator2.add_worker(analytics_worker)\n",
        "orchestrator2.add_worker(notification_worker)\n",
        "print()\n",
        "\n",
        "orchestrator2.execute(\n",
        "    \"Fetch user data from database, call the analytics API, analyze growth trends, and notify the team\"\n",
        ")\n",
        "\n",
        "\n",
        "# Example 3: Customer Support Triage\n",
        "print(\"\\n\" + \"=\"*60)\n",
        "print(\"EXAMPLE 3: Customer Support Automation\")\n",
        "print(\"=\"*60)\n",
        "\n",
        "orchestrator3 = Orchestrator()\n",
        "\n",
        "# Specialized support workers\n",
        "tech_support = Worker(\n",
        "    \"TechSupport\",\n",
        "    \"Technical troubleshooting\",\n",
        "    {\"search\": search_web, \"database\": fetch_database}\n",
        ")\n",
        "\n",
        "billing_support = Worker(\n",
        "    \"BillingAgent\",\n",
        "    \"Billing and payments\",\n",
        "    {\"database\": fetch_database, \"calculate\": calculate}\n",
        ")\n",
        "\n",
        "account_support = Worker(\n",
        "    \"AccountAgent\",\n",
        "    \"Account management\",\n",
        "    {\"api\": api_call, \"notify\": send_notification}\n",
        ")\n",
        "\n",
        "orchestrator3.add_worker(tech_support)\n",
        "orchestrator3.add_worker(billing_support)\n",
        "orchestrator3.add_worker(account_support)\n",
        "print()\n",
        "\n",
        "orchestrator3.execute(\n",
        "    \"Customer needs help with a billing issue, wants to check their account status, and needs a technical search for VPN setup\"\n",
        ")\n",
        "\n",
        "\n",
        "# Example 4: Complex Multi-step Project\n",
        "print(\"\\n\" + \"=\"*60)\n",
        "print(\"EXAMPLE 4: Project Execution with Multiple Specialists\")\n",
        "print(\"=\"*60)\n",
        "\n",
        "orchestrator4 = Orchestrator()\n",
        "\n",
        "# Add all types of workers\n",
        "orchestrator4.add_worker(research_worker)\n",
        "orchestrator4.add_worker(data_worker)\n",
        "orchestrator4.add_worker(db_worker)\n",
        "orchestrator4.add_worker(api_worker)\n",
        "orchestrator4.add_worker(report_worker)\n",
        "orchestrator4.add_worker(notification_worker)\n",
        "print()\n",
        "\n",
        "orchestrator4.execute(\n",
        "    \"Research AI trends, fetch database metrics, call growth API, analyze all data, generate comprehensive report, and notify stakeholders\"\n",
        ")\n",
        "\n",
        "print(\"✅ Orchestrator-Worker Pattern Complete!\")"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "id": "DP52OV0in5Rk",
        "outputId": "43733d7d-8975-42a7-8180-5441852ba72f"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "============================================================\n",
            "EXAMPLE 1: Multi-Domain Research\n",
            "============================================================\n",
            "➕ Registered: ResearchBot (Web research specialist)\n",
            "➕ Registered: DataAnalyst (Data analysis specialist)\n",
            "➕ Registered: ReportWriter (Report generation specialist)\n",
            "\n",
            "\n",
            "============================================================\n",
            "🎯 Task: Research climate change trends, analyze the data, and generate a report\n",
            "============================================================\n",
            "\n",
            "📋 Step 1: Decomposing task...\n",
            "   Created 4 subtasks:\n",
            "\n",
            "   1. 1. ResearchBot: Research and gather climate change data from reputable sources (e.g., NASA, NOAA, IPCC).\n",
            "   2. 2. DataAnalyst: Analyze the collected data to identify key trends, anomalies, and correlations.\n",
            "   3. 3. DataAnalyst: Calculate statistical significance of observed trends and create visualizations.\n",
            "   4. 4. ReportWriter: Generate a comprehensive report summarizing the research findings, data analysis, and key conclusions.\n",
            "\n",
            "👥 Step 2: Assigning workers...\n",
            "   Assigned 4 tasks:\n",
            "\n",
            "   - ResearchBot: 1. ResearchBot: Research and gather climate change...\n",
            "   - DataAnalyst: 2. DataAnalyst: Analyze the collected data to iden...\n",
            "   - DataAnalyst: 3. DataAnalyst: Calculate statistical significance...\n",
            "   - ResearchBot: 4. ReportWriter: Generate a comprehensive report s...\n",
            "\n",
            "⚡ Step 3: Executing in parallel...\n",
            "\n",
            "  👷 ResearchBot working on: 1. ResearchBot: Research and gather climate change data from...\n",
            "     ✅ Completed with search\n",
            "\n",
            "  👷 DataAnalyst working on: 2. DataAnalyst: Analyze the collected data to identify key t...\n",
            "     ✅ Completed with analyze\n",
            "\n",
            "  👷 DataAnalyst working on: 3. DataAnalyst: Calculate statistical significance of observ...\n",
            "     ✅ Completed with calculate\n",
            "\n",
            "  👷 ResearchBot working on: 4. ReportWriter: Generate a comprehensive report summarizing...\n",
            "     ✅ Completed with search\n",
            "\n",
            "🔗 Step 4: Synthesizing results...\n",
            "\n",
            "============================================================\n",
            "📊 FINAL ANSWER\n",
            "============================================================\n",
            "**Climate Change Trends Report**\n",
            "\n",
            "This report summarizes the research and analysis of recent climate change data.\n",
            "\n",
            "**Key Findings:**\n",
            "\n",
            "*   **Global Temperature Rise:** Global temperatures have risen by 1.1°C since pre-industrial times (Source: ResearchBot, based on data from reputable sources like NASA, NOAA, and IPCC).\n",
            "*   **Key Trends:** Data analysis identified three significant climate change trends with an 85% confidence level (Source: DataAnalyst). Action A is recommended based on these trends.\n",
            "*   **Statistical Analysis:**\n",
            "    *   Total: 1,250\n",
            "    *   Average: 208.33\n",
            "    *   Growth Rate: 12.5% (Source: DataAnalyst) - This likely refers to a specific metric related to the identified trends.\n",
            "\n",
            "**Further Action Needed:**\n",
            "\n",
            "*   The ReportWriter task was not successfully completed, and needs further development. The final report summarizing all the data should be written.\n",
            "\n",
            "**Note:** This report is incomplete due to the unfinished task of ReportWriter. The report should include visualizations, clearly identify the data behind the statistical analysis (Total, Average, Growth Rate), describe \"Action A\", and fully describe the three key trends identified by DataAnalyst.\n",
            "\n",
            "\n",
            "============================================================\n",
            "EXAMPLE 2: Enterprise Data Pipeline\n",
            "============================================================\n",
            "➕ Registered: DatabaseAgent (Database operations)\n",
            "➕ Registered: APIAgent (External API integration)\n",
            "➕ Registered: AnalyticsAgent (Data analytics)\n",
            "➕ Registered: NotificationAgent (Communication services)\n",
            "\n",
            "\n",
            "============================================================\n",
            "🎯 Task: Fetch user data from database, call the analytics API, analyze growth trends, and notify the team\n",
            "============================================================\n",
            "\n",
            "📋 Step 1: Decomposing task...\n",
            "   Created 4 subtasks:\n",
            "\n",
            "   1. 1.  DatabaseAgent: Fetch user data from the database. (tools: database, fetch)\n",
            "   2. 2.  APIAgent: Call the analytics API to retrieve relevant metrics. (tools: api, call)\n",
            "   3. 3.  AnalyticsAgent: Analyze the fetched user data and API metrics to identify growth trends. (tools: analyze, calculate)\n",
            "   4. 4.  NotificationAgent: Notify the team with the analysis of growth trends. (tools: notify, send)\n",
            "\n",
            "👥 Step 2: Assigning workers...\n",
            "   Assigned 4 tasks:\n",
            "\n",
            "   - DatabaseAgent: 1.  DatabaseAgent: Fetch user data from the databa...\n",
            "   - APIAgent: 2.  APIAgent: Call the analytics API to retrieve r...\n",
            "   - DatabaseAgent: 3.  AnalyticsAgent: Analyze the fetched user data ...\n",
            "   - NotificationAgent: 4.  NotificationAgent: Notify the team with the an...\n",
            "\n",
            "⚡ Step 3: Executing in parallel...\n",
            "\n",
            "  👷 DatabaseAgent working on: 1.  DatabaseAgent: Fetch user data from the database. (tools...\n",
            "     ✅ Completed with database\n",
            "\n",
            "  👷 APIAgent working on: 2.  APIAgent: Call the analytics API to retrieve relevant me...\n",
            "     ✅ Completed with api\n",
            "\n",
            "  👷 DatabaseAgent working on: 3.  AnalyticsAgent: Analyze the fetched user data and API me...\n",
            "     ✅ Completed with fetch\n",
            "\n",
            "  👷 NotificationAgent working on: 4.  NotificationAgent: Notify the team with the analysis of ...\n",
            "     ✅ Completed with notify\n",
            "\n",
            "🔗 Step 4: Synthesizing results...\n",
            "\n",
            "============================================================\n",
            "📊 FINAL ANSWER\n",
            "============================================================\n",
            "**User Growth Analysis Report:**\n",
            "\n",
            "*   **Data Sources:** User data was fetched from the database (127 records) and analytics metrics were retrieved from the API.\n",
            "*   **Key Metrics:**\n",
            "    *   Database sample user (ID 1001) Value is 250 and Status is Active.\n",
            "    *   API indicates 1500 users, 1200 active users, and a 15% growth rate.\n",
            "*   **Analysis:** (Implicit in the results, analysis step was performed by Analytics Agent, but result not given)\n",
            "*   **Notification:** The team was notified of these findings via email and Slack.\n",
            "\n",
            "**In summary, the process successfully fetched user data, retrieved analytics metrics indicating a 15% user growth, and alerted the relevant team members.**\n",
            "\n",
            "\n",
            "============================================================\n",
            "EXAMPLE 3: Customer Support Automation\n",
            "============================================================\n",
            "➕ Registered: TechSupport (Technical troubleshooting)\n",
            "➕ Registered: BillingAgent (Billing and payments)\n",
            "➕ Registered: AccountAgent (Account management)\n",
            "\n",
            "\n",
            "============================================================\n",
            "🎯 Task: Customer needs help with a billing issue, wants to check their account status, and needs a technical search for VPN setup\n",
            "============================================================\n",
            "\n",
            "📋 Step 1: Decomposing task...\n",
            "   Created 3 subtasks:\n",
            "\n",
            "   1. 1.  BillingAgent: Investigate billing issue using database.\n",
            "   2. 2.  AccountAgent: Check and report account status using API.\n",
            "   3. 3.  TechSupport: Perform technical search for VPN setup instructions.\n",
            "\n",
            "👥 Step 2: Assigning workers...\n",
            "   Assigned 3 tasks:\n",
            "\n",
            "   - TechSupport: 1.  BillingAgent: Investigate billing issue using ...\n",
            "   - AccountAgent: 2.  AccountAgent: Check and report account status ...\n",
            "   - TechSupport: 3.  TechSupport: Perform technical search for VPN ...\n",
            "\n",
            "⚡ Step 3: Executing in parallel...\n",
            "\n",
            "  👷 TechSupport working on: 1.  BillingAgent: Investigate billing issue using database....\n",
            "     ✅ Completed with database\n",
            "\n",
            "  👷 AccountAgent working on: 2.  AccountAgent: Check and report account status using API....\n",
            "     ✅ Completed with api\n",
            "\n",
            "  👷 TechSupport working on: 3.  TechSupport: Perform technical search for VPN setup inst...\n",
            "     ✅ Completed with search\n",
            "\n",
            "🔗 Step 4: Synthesizing results...\n",
            "\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "WRhbg75ZoQHh"
      },
      "execution_count": null,
      "outputs": []
    }
  ]
}